from flask.ext import restful
from flask.ext.restful import fields, marshal_with, reqparse,Resource,marshal_with
""" 
post_parser = reqparse.RequestParser()
post_parser.add_argument(

)
post_parser.add_argument(

)
post_parser.add_argument(

)
"""
MYSQLINSTANCES={'id':1,'mysqlHost':'192.168.1.1','mysqlPort':3306,'mysqlComment':'mysql1','isMaster':1,'groupId':1,'masterId':1},{'id':2,'mysqlHost':'192.168.1.2','mysqlPort':3306,'mysqlComment':'mysql2','isMaster':0,'groupId':1,'masterId':1}
"""
MYSQLINSTANCES={
    'MYSQL1':{'id':1,'mysqlHost':'192.168.1.1','mysqlPort':3306,'mysqlComment':'mysql1','isMaster':1,'groupId':1,'masterId':1},
    #'MYSQL2':{'id':2,'mysqlHost':'192.168.1.2','mysqlPort':3306,'mysqlComment':'mysql2','isMaster':0,'groupId':1,'masterId':1},
    #'MYSQL3':{'id':3,'mysqlHost':'192.168.1.3','mysqlPort':3306,'mysqlComment':'mysql3','isMaster':1,'groupId':2,'masterId':3},
    #'MYSQL4':{'id':4,'mysqlHost':'192.168.1.4','mysqlPort':3306,'mysqlComment':'mysql4','isMaster':0,'groupId':2,'masterId':3},
}
"""
mysqlInstance_fields = {
    'id': fields.Integer,
    'mysqlHost': fields.String,
    'mysqlPort': fields.Integer,
    'mysqlComment': fields.String,
    'isMaster': fields.Integer,
    'groupId': fields.Integer,
    'masterId': fields.Integer,
}
mysqlInstanceList_fields = {
    'groupName': fields.String,
}
mysqlInstanceGroup_fields = {
    'id': fields.Integer,
    'groupName': fields.String,
}

TODOS = {
    'todo1': {'task': 'build an API'},
    'todo2': {'task': '?????'},
    'todo3': {'task': 'profit!'},
}

class MysqlRunStatus(restful.Resource):
    pass

class MysqlInstanceList(Resource):
    @marshal_with(mysqlInstance_fields)
    def get(self):
        return MYSQLINSTANCES

class MysqlInstanceGroupList(Resource):
    def get(self):
        return MYSQLINSTANCES